// 将参数用&进行拼接
export function urlEncode(param, key, encode) {
    if (param == null) return '';
    var paramStr = '';
    var t = typeof (param);
    if (t === 'string' || t === 'number' || t === 'boolean') {
        paramStr += '&' + key + '=' + ((encode == null || encode) ? encodeURIComponent(param) : param);
    } else {
        for (var i in param) {
            var k = key == null ? i : key + (param instanceof Array ? '[' + i + ']' : '.' + i);
            paramStr += urlEncode(param[i], k, encode);
        }
    }
    return paramStr
}

// 获取系统信息
export function getSystemInfo() {
    const res = wx.getSystemInfoSync()
    return res
}

// 获取胶囊按钮信息
export function getMenuInfo() {
    const res = wx.getMenuButtonBoundingClientRect()
    return res
}

// 格式化时间
export function formatTime(date) {
    return date.split(" ")[0].replace(/-/g, ".")
}
